import org.junit.Test;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.support.ResourcePropertySource;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ZLL
 * @date create in 2018/04/27
 */
public class PropertySourceTesst {


    @Test
    public void test1() throws Exception{
//        System.out.println(111);
//
//        Map<String, Object> map = new HashMap<>();
//        map.put("encoding","GBK");

//        MapPropertySource propertySource = new MapPropertySource("map", map);


        ResourcePropertySource resourcePropertySource = new ResourcePropertySource("classpath:messages.properties");


        System.out.println(resourcePropertySource.getProperty("user.id.null"));

        System.out.println(resourcePropertySource.getProperty("encoding"));


        Environment e = new StandardEnvironment();
        System.out.println(e.getProperty("file.encoding"));
    }
}
